package com.heima.collectionAndMap.collection.set;

import com.heima.collectionAndMap.collection.set.pojo.Student;

import java.util.LinkedHashSet;

public class LinkedHashSetDemo {
    public static void main(String[] args) {

        // 1. 创建学生对象
        Student stu1 = new Student("cen1", 20);
        Student stu2 = new Student("cen2", 20);
        Student stu3 = new Student("cen3", 20);
        Student stu4 = new Student("cen4", 20);

        // 2. 创建LinkedHashSet对象
        LinkedHashSet<Student> linkedHashSet = new LinkedHashSet<>();

        // 3. 添加元素
        linkedHashSet.add(stu1);
        linkedHashSet.add(stu2);
        linkedHashSet.add(stu3);
        linkedHashSet.add(stu4);

        // 4. 打印元素
        System.out.println(linkedHashSet);
    }
}
